<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/angular.min.js"></script>
    <script>
        let app = angular.module('myapp',[]);
        app.controller('mycontroller',function ($scope,$http) {
            $scope.initMethod=function () {
                let id = localStorage.getItem("id");
                $http.get('../tbschool/findbyid.do?id='+id).success(function (response) {
                    $scope.list=response;
                })

            }
            $scope.qvxiao=function () {
                location.href="list.html";
            }
            $scope.queding=function (id) {
                $http.post("../tbschool/update.do",$scope.list).success(function (response) {
                    if (response.success){
                        alert("修改成功");
                        location.href="list.html";
                    }else {
                        alert("修改失败");
                        location.reload();
                    }
                })
            }
        })
    </script>
</head>
<body ng-app="myapp" ng-controller="mycontroller" ng-init="initMethod()">
    <div >

        <table>
                <h1>修改学校</h1>
            <tr>
                <td>校徽</td>
                <td><input type="text" ng-model="list.pic"></td>
            </tr>
            <tr>
                <td>学校</td>
                <td><input type="text" ng-model="list.name"></td>
            </tr>
            <tr>
                <td>banner</td>
                <td><input type="text" ng-model="list.banner"></td>
            </tr>
            <tr>
                <td>域名</td>
                <td><input type="text" ng-model="list.ipaddress"></td>
            </tr>
            <tr>
                <td>版权</td>
                <td><input type="text" ng-model="list.version"></td>
            </tr>
            <tr>
                <td><input type="button" value="取消" ng-click="qvxiao()"></td>
                <td><input type="button" value="确定" ng-click="queding(list.id)"></td>
            </tr>
        </table>
    </div>
</body>
</html>